package com.example.test_demo.config;

import com.example.test_demo.entity.Stu;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpringByJavaConfig {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx=new AnnotationConfigApplicationContext(JavaConfig.class);
        Stu stu=ctx.getBean("stu",Stu.class);
        System.out.println(stu);
        ctx.registerShutdownHook();//销毁
    }
}
